#ifndef __SW_LED_KEY_H_H_
#define __SW_LED_KEY_H_H_

#include "stdint.h"

#ifdef __cplusplus
extern "C"
{
#endif

	typedef struct
	{
		uint32_t key_val;		  
		uint8_t key_send_amount;  

		union {
			struct {
				uint8_t tig_key_send_index; 
				uint8_t tig_key_next_index; 
				uint8_t tig_key_list[4];	
				uint8_t key_send_cnt;		
			} mst;

			struct {
				uint8_t st_tig_rx_ok;		
				uint8_t tig_key_val;		
			}slv;
		} state;
	} key_com_type;

	void key_com_init(key_com_type* obj); 
	void key_slv_rx(key_com_type* obj, uint8_t rx_dat);											 
	uint8_t key_mst_tx(key_com_type* obj);														 
	void key_mst_set(key_com_type* obj, uint32_t key_val);									     
	void key_mst_tig(key_com_type* obj, uint8_t gp, uint8_t val);								 

	typedef struct
	{
		uint16_t* key_buff;  
		uint8_t zone_amount; 

		uint8_t message_code[12]; 
		uint8_t message_cnt;	  
		uint8_t message_size;     
	} key_code_com_type;

	void key_code_com_mst_handle(key_code_com_type* obj);

	void key_code_com_slv_handle(key_code_com_type* obj);

	void key_code_com_slv_receive(key_code_com_type* obj, uint8_t rdata);

#ifdef __cplusplus
}
#endif

#endif 
